package com.zhora.ai.v1.business.impl;

import com.zhora.ai.v1.business.IAiLibraryDocBusinessService;
import com.zhora.ai.v1.dto.AiLibraryDocDetailDTO;
import com.zhora.ai.v1.dto.AiLibraryDocListDTO;
import com.zhora.ai.v1.vo.AiLibraryDocListVO;
import com.zhora.common.utils.ConvertUtils;
import com.zhora.dto.ai.search.AiLibraryDocSearchDTO;
import com.zhora.service.ai.IAiLibraryDocService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * doc业务实现
 *
 * @author zhehen.lu
 * @date 2025/9/28 15:55
 */
@Service
@Slf4j
public class AiLibraryDocBusinessServiceImpl implements IAiLibraryDocBusinessService {

    @Autowired
    private IAiLibraryDocService libraryDocService;

    @Override
    public AiLibraryDocDetailDTO getDetailById(Long id) {
        return ConvertUtils.sourceToTarget(libraryDocService.getDetailById(id), AiLibraryDocDetailDTO.class);
    }

    @Override
    public List<AiLibraryDocListDTO> list(AiLibraryDocListVO listVO) {
        AiLibraryDocSearchDTO searchDTO = ConvertUtils.sourceToTarget(listVO, AiLibraryDocSearchDTO.class);
        searchDTO.setDelFlag(Boolean.FALSE);
        return ConvertUtils.sourceToTarget(libraryDocService.list(searchDTO), AiLibraryDocListDTO.class);
    }
}
